package cn.dhnep.demo.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author dhn
 * @since 2021-08-09
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "Admin对象", description = "")
public class Admin implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "admin_id", type = IdType.AUTO)
    private Integer adminId;

    @NotBlank(message = "管理员姓名不能为空")
    private String adminName;

    @TableField("admin_nickName")
    @NotBlank(message = "管理员登录用户名不能为空")
    private String adminNickname;

    @NotBlank(message = "管理员手机号不能为空")
    private String adminPhone;

    private String adminAddress;

    @NotBlank(message = "密码不能为空")
    private String adminPassword;

    @ApiModelProperty(value = "管理员登录状态")
    private Integer adminState;

    @ApiModelProperty(value = "管理员头像路径")
    @NotBlank(message = "请先上传头像")
    private String adminHeader;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    private Date updateTime;

    private String openId;

    //配置一对多关系映射
    @ApiModelProperty(value = "所拥有的角色")
    @TableField(exist = false)
    private List<Role> roles;

    @ApiModelProperty(value = "所拥有的角色id")
    @TableField(exist = false)
    public Integer[] roleIds;


}
